/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TableModels;

import Entities.BoothInformation;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author tuanba_b00920
 */
public class BoothTableModel extends AbstractTableModel{
   ArrayList<BoothInformation> arrList;
   public BoothTableModel(ArrayList<BoothInformation> arrList)
   {
      this.arrList=arrList;
   }
    @Override
    public int getRowCount() {
        return arrList.size();
    }

    @Override
    public int getColumnCount() {
        return 11;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        BoothInformation objBooth=arrList.get(rowIndex);
        Object value=null;
      switch(columnIndex)
      {
         case 0:
              value =objBooth.getId();
              break;
          case 1:
               value=objBooth.getName();
              break;
          case 2:
              value=objBooth.getSpace();
              break;
          case 3:
              value=objBooth.getSpaceUnitMeasureID();
              break;
          case 4:
              value=objBooth.getFees();
              break;
          case 5:
              value=objBooth.getSponsor();
              break;
          case 6:
              value=objBooth.getExhibitorID();
              break;
          case 7:
              value=objBooth.getContractCode();
              break;
          case 8:
              // value=objBooth.getStatus();
              if(objBooth.getStatus() == 1){
                    value = "Normal";
              }else{
                    value = "Block";
              }
               break;
          case 9:
              value=objBooth.getRegisterDate();
              break;
          case 10:
              value=objBooth.getMoDifiedDate();
              break;
      }
      return value;
    }
      @Override
    public String getColumnName(int column) {
        String colName = "";
        switch(column){
            case 0:
                colName = "IDs";
                break;
            case 1:
                colName = "Name";
                break;
            case 2:
                colName = "Space";
                break;
           case 3:
                colName = "SpaceUnitMeasure";
                break;
            case 4:
                colName = "Fees";
                break;
            case 5:
                colName = "Sponor";
                break;
            case 6:
                colName = "Exhibitor ID";
                break;
            case 7:
                colName = "Contract Code";
                break;
             case 8:
                colName = "Status";
                break;
             case 9:
                colName = "Register Date";
                break;
            case 10:
                colName = "Modified Date";
                break;


        }
        return colName;
    }
  public BoothInformation Getvalue(int index){
  return arrList.get(index);
  }

}
